<IfModule mod_rewrite.c>
RewriteEngine On # Allow access to the storage folder
RewriteCond %{REQUEST_URI} ^/storage/ [NC]
RewriteRule ^ - [L] # Redirect all other requests to the public folder
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
# ----------------------------------------------------------------------
# Better website experience for IE users
# ---------------------------------------------------------------------- <IfModule mod_headers.c>
# Force the latest IE version
Header set X-UA-Compatible "IE=Edge"
# Unset X-UA-Compatible for specific file types
<FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webm|webp|woff|woff2|xml|xpi)$">
Header unset X-UA-Compatible
</FilesMatch>
</IfModule> <IfModule mod_setenvif.c>
<IfModule mod_headers.c>
# Handle CORS for specific file types
<FilesMatch "\.(gif|ico|jpe?g|png|svg|svgz|webp)$">
SetEnvIf Origin ":" IS_CORS
Header set Access-Control-Allow-Origin "*" env=IS_CORS
</FilesMatch>
</IfModule>
</IfModule> # ----------------------------------------------------------------------
# Proper MIME type for all files
# ---------------------------------------------------------------------- # JavaScript
AddType application/javascript js jsonp
AddType application/json json # Audio
AddType audio/mp4 m4a f4a f4b
AddType audio/ogg oga ogg # Video
AddType video/mp4 mp4 m4v f4v f4p
AddType video/ogg ogv
AddType video/webm webm
AddType video/x-flv flv # SVG
AddType image/svg+xml svg svgz
AddEncoding gzip svgz # Webfonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType application/x-font-woff woff
AddType application/x-font-woff woff2
AddType font/opentype otf # Assorted types
AddType application/octet-stream safariextz
AddType application/x-chrome-extension crx
AddType application/x-opera-extension oex
AddType application/x-shockwave-flash swf
AddType application/x-web-app-manifest+json webapp
AddType application/x-xpinstall xpi
AddType application/xml rss atom xml rdf
AddType image/webp webp
AddType image/x-icon ico
AddType text/cache-manifest appcache manifest
AddType text/vtt vtt
AddType text/x-component htc
AddType text/x-vcard vcf # ----------------------------------------------------------------------
# Caching and Expiry Headers
# ---------------------------------------------------------------------- <IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 2 days"
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/jpg "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType application/x-javascript "access plus 60 days"
ExpiresByType text/css "access plus 60 days"
ExpiresByType image/x-icon "access plus 360 days"
# Cache-Control Headers for static assets
<FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|html|htm|xml|txt|xsl|css)$">
Header set Cache-Control "max-age=31536050"
</FilesMatch>
</IfModule> # ----------------------------------------------------------------------
# Compression Settings
# ---------------------------------------------------------------------- <IfModule mod_deflate.c>
# Compress various types of files
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</IfModule> # ----------------------------------------------------------------------
# Security - Deny Access to Sensitive Files
# ---------------------------------------------------------------------- <IfModule mod_rewrite.c>
<Files .env>
Order allow,deny
Deny from all
</Files>
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
<Files composer.json>
Order allow,deny
Deny from all
</Files>
</IfModule> # ----------------------------------------------------------------------
# URL Rewriting for Clean URLs and Security
# ---------------------------------------------------------------------- <IfModule mod_rewrite.c>
RewriteEngine On
# Redirect trailing slashes if not a folder
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Redirect non-www to www (Update with your own domain)
RewriteCond %{HTTP_HOST} ^trickprof.com [NC]
RewriteRule ^(.*)$ https://www.trickprof.com/$1 [L,R=301]
# Allow access to the storage folder
RewriteCond %{REQUEST_URI} ^/storage/ [NC]
RewriteRule ^ - [L] # Redirect all other requests to the public folder
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
We are Recommending you:
- Integrate Zoho SMTP Mail Configurations in Laravel?
- Laravel remove public from url
- Laravel 7 multi auth login
- Custom 404 Page In Laravel 8
- How to generate dynamic real time sitemap.xml file in Laravel 8
- How to use soft delete in Laravel?
- Why Use the Repository Pattern in a Laravel Application
- Laravel 8 .htaccess file for php 8
- How to create real time sitemap.xml file in Laravel
Step Out of Your Comfort Zone: 10 Powerful...
Is Mobile Reels Harming Our Children? Here's...
Simple body language tricks1. Stand with...
Best Free Websites to Learn CodingIf you...
To place INR currency symbol in pdf while...
these are following steps to remove...
for hide option value on other select...
The following steps help you to create a...
Shortcut Keys ...